home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / amos / AMCAFExa.lha / AMCAF_Examples / MaskCopy.AMOS / MaskCopy.amosSourceCode
Encoding:
AMOS Source Code  |  1996-01-17  |  1.8 KB  |  50 lines

  1. ' ************************************* Commands used: 
  2. ' *                                   * Mask Copy  
  3. ' *           Amcaf Examples          * Fcircle
  4. ' *           Mask Copy V1.0          * Fellipse 
  5. ' *      Written by Chris Hodges      * (Blitter Copy Limit) 
  6. ' *                                   * (Blitter Copy) 
  7. ' ************************************* (=Binlog)  
  8. '
  9. ' Load an iff picture and hide it from view. 
  10. Load Iff "Data/Weazle.iff",0 : Screen Hide 
  11. ' Now get screen dimensions and number of colours. 
  12. WX=Screen Width : WY=Screen Height
  13. AC=Screen Colour
  14. ' Open a screen to hold the mask. Same size as the original picture but only 
  15. ' two colours. 
  16. Screen Open 2,WX,WY,2,0 : Screen Hide 
  17. Curs Off : Flash Off : Paper 0 : Pen 1 : Cls 
  18. ' Open a screen to copy the new image onto. Again the same size, but this time 
  19. ' with AC colours. 
  20. Screen Open 1,WX,WY,AC,0
  21. Curs Off : Flash Off : Paper 0 : Pen 1 : Cls 
  22. ' Copy the palette of the original picture 
  23. Get Palette 0
  24. ' Double buffer to avoid flickering. 
  25. Double Buffer 
  26. Autoback 0
  27. ' Now calculate the middle of the screen. Activate the mask-screen.
  28. Screen 2
  29. MX=WX/2 : MY=WY/2
  30. For A=1 To MX-19 Step 4
  31.   ' Draw some gfx onto the mask screen. These are 2-coloured.
  32.    Extension_8_05E6 MX,MY,A
  33.    Extension_8_05F8 0,0,A/2+1,A
  34.    Extension_8_05F8 WX-1,0,A/2+1,A
  35.    Extension_8_05F8 0,WY-1,A/2+1,A
  36.    Extension_8_05F8 WX-1,WY-1,A/2+1,A
  37.   ' Now copy the original screen to the new one, using the template from 
  38.   ' Screen 2.
  39.    Extension_8_086C 0 To 1,Logbase(0)
  40.   ' PS: a nice replacement routine for Mask Copy. Test it, it's faster!
  41. '  Blitter Copy Limit 0
  42. '  For B=0 To Binlog(AC)-1 
  43. '    Blitter Copy 0,B,2,0 To 1,B,%11000000 
  44. '  Next  
  45.   ' Display the new screen.
  46.   Screen Swap 1 : Wait Vbl 
  47. Next 
  48. ' Last frame: Copy the whole screen to complete the image. 
  49. Screen Copy 0 To 1
  50. Screen Swap 1 : Wait Vbl